import java.util.Scanner;

public class test622 {
    public static double sqrt(long n) {
        double lastGuess = 1.0;
        double nextGuess;
        
        do {
            nextGuess = (lastGuess + n / lastGuess) / 2;
            if (Math.abs(nextGuess - lastGuess) < 0.001) {
                break;
            }
            lastGuess = nextGuess;
        } while (true);
        
        return nextGuess;
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入一个整数n:");
        long n = scanner.nextLong();
        
        double result = sqrt(n);
        System.out.println(n + " 的平方根近似值是：" + result);
        scanner.close();
    }
}
